var https=require("https");        //网络请求

var fs=require("fs");            //操作文件，读写文件

const cheerio = require("cheerio") //dom解析依赖



let htmlStr = ""
const url = "https://blog.csdn.net/shaopengjie2/article/details/118759304"
https.get(url,(res)=>{
     res.on('data',(chunk)=>{
      htmlStr += chunk
     })
     res.on('end',()=>{
      // console.log(htmlStr)
      let $ = cheerio.load(htmlStr)
      let article = ""
      $('p').each((id,el)=>{
        article += $(el).text() + "\n"
      })
      console.log(article); 
     })
})
